package com.desire.controller;

import com.desire.bean.UserBean;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

/**
 * @author LittleDesire
 * @description
 * @date 2022-04-22 周五 10:45
 * @since 17
 */
@RestController
public class IndexController {
    @GetMapping("getAll/{id}") // 实际参数
    public List<UserBean> getAll(@PathVariable Integer id) { //  @PathVariable 映射路径 Integer id
        ArrayList<UserBean> list = new ArrayList<>();
        list.add(new UserBean(1, "root"));
        list.add(new UserBean(2, "baba"));
        list.add(new UserBean(3, "nihao"));
        return list;
    }
}
